package great.project.param.controller;

import great.project.param.domain.RequestParams;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 *  <div  style="border:2px solid none;margin:20px;padding:15px;font-size:24px;text-align:center;color:aqua;">
 *
 *
 *
 *  </div>
 * @author v_zhangshun01
 * @date 2021/11/25 7:06 下午
 */
@RestController
public class TestController {

    @GetMapping("test01")
    public RequestParams test01(
            @RequestParam("params") RequestParams requestParams
    ){
        return requestParams;
    }

    @GetMapping("test02")
    public String test02(
            @RequestParam("date") Date date
    ){
        System.out.println(date);
        if (date == null) {
            return null;
        }
        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date);
    }

}
